<% layout('/layouts/default.html', {title: 'activity_carousel管理', libs: ['validate','ueditor','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(activityCarousel.isNewRecord ? '新增activity_carousel' : '编辑activity_carousel')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${activityCarousel}" action="${ctx}/activity/activityCarousel/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="id"/>
				<div class="row">
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('标题')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="titile" maxlength="25" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('权重')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="weight" maxlength="255" class="form-control digits" placeholder="默认为最大"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('类型')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="type" dictType="ac_cl_type" class="form-control required" />
							</div>
						</div>
					</div>
                </div>
				<#form:hidden path="activityContentId"/>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
                                <span class="required">*</span> ${text('内容')}：<i class="fa icon-question hide"> </i>
							</label>
						</div>
					</div>
					<div class="col-sm-10 col-sm-offset-2">
						<#form:ueditor name="contentEditor" value="${activityCarouselContent}" maxlength="10000" height="200" simpleToolbars="false" readonly="false" outline="false"/>
					</div>
				</div>
					<br/>
				<div class="row">
						<div class="col-xs-6">
							<div class="form-group">
								<label class="control-label col-sm-4" title="">
                                                                <span class="required hide">
                                                                    *
                                                                </span>
									${text('活动封面')}：
									<i class="fa icon-question hide">
									</i>
								</label>
								<div class="col-sm-8">
									<label style="display: none">
										<#form:input path="imgUrl" name="imgUrl" id="imgUrl" maxlength="255" class="form-control  required"/>
									</label>
									<img class="" src="${activityCarousel.imgUrl}" id="showImg" onerror="this.src='/js/static/images/default.jpg'"/>
									<div class="hidden">
										<#form:fileupload path="imgUrl" id="upload" bizKey="${activityCarousel.id}" bizType="activityCarousel" uploadType="image"  allowSuffixes=".jpg,.png,.jpeg" returnPath="true" filePathInputId="imgUrl" isMini="true"  readonly="false"/>
									</div>
								</div>
							</div>
						</div>
					</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('位置')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:treeselect id="activityLocationCode" title="${text('区域选择')}" path="activityLocationCode" labelPath="activityLocation" canSelectRoot="true" canSelectParent="true" returnFullName="false" returnFullNameSplit="-" url="${ctx}/sys/area/treeData" class="" allowClear="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="activityTime" readonly="true" maxlength="20" class="form-control Wdate required"
									dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('备注信息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('activity:activityCarousel:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
$(document).ready(function () {

    $("#showImg").click(function () {
        $("#uploadfileLists").children().remove();
        $(".webuploader-element-invisible")[0].click();
    });
    $("#imgUrl").change(function () {
        var url = $(this)[0].value;
        var arr = url.split("|");
        url = arr[arr.length-1];
        $(this)[0].value = url;
        $("#showImg")[0].src = $(this)[0].value;
    });
});
</script>